feat(changelog): PR 3a — per-entry changelog read-path dispatch#4521
Closed
Copilot wants to merge 3 commits into
Closed
feat(changelog): PR 3a — per-entry changelog read-path dispatch#4521Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
✅ Deploy Preview for nifty-bassi-e26446 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Add AChangelog._is_current property (version == changelogs.current) - Update AChangelog.data to dispatch to get_data_from_entries when changelogs._entries_layout is True and self._is_current is True - Add AChangelogs._entries_layout property (is_dir check, not cached) - Add AChangelogs.current_dir_path / rel_current_dir_path properties - Add/update tests for all new properties and 4 dispatch combinations Agent-Logs-Url: https://github.com/envoyproxy/toolshed/sessions/3c33e997-440b-41d8-b26b-d64707f25344 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Agent-Logs-Url: https://github.com/envoyproxy/toolshed/sessions/3c33e997-440b-41d8-b26b-d64707f25344 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement read-path for per-entry changelog plan PR 3a
feat(changelog): PR 3a — per-entry changelog read-path dispatch
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the read-path half of Toolshed PR 3 from the per-entry changelog plan (#4498). Adds layout detection and dispatches
AChangelog.datatoget_data_from_entrieswhen the entries layout is active; legacy YAML layout is fully preserved.Layout detection
AChangelogs._entries_layout(@property, not cached): singleis_dir()check againstchangelogs/current/. No config flag, no version pin — presence of the directory is the sole signal.AChangelogs.current_dir_path/rel_current_dir_path: mirrors the existingcurrent_path/rel_current_pathpair; consumed by the dispatch below and by PR 3b (write-path).Dispatch in
AChangelog.dataAChangelog._is_current(@property):self.version == self.project.changelogs.current.datanow dispatches:_entries_layoutis evaluated first so legacy repos short-circuit before touching_is_current. Historical<version>.yamlfiles always use the legacy reader.validate_sectionsruns on both branches.Tests
test_abstract_changelogs_entries_layout— parametrized[True, False], assertsis_dir()call and no caching.test_abstract_changelogs_current_dir_path/rel_current_dir_path— mirrors existing path property tests.test_abstract_changelog__is_current— parametrized[True, False].test_abstract_changelog_data— replaced with parametrized[entries_layout × is_current]covering all four dispatch combinations; asserts correct function reference and args passed toproject.execute, and thatvalidate_sectionsis called in every case.test_abstract_changelog_data_unknown_section(existing integration test) passes unchanged.Original prompt
Context
Implements PR 3a of the per-entry changelog plan (see #4498, #4499, and
plans/per-entry-changelog-4498.md). This is the read-path half of "Toolshed PR 3"; the write-path half (write_version/write_current/write_date/changes_for_commit) lands separately as PR 3b.Dependencies landed:
envoy.base.utils: Add per-entry RST directory reader #4518 —AChangelog.get_data_from_entries(yaml_path, entry_dir)exists.envoy.base.utils: Switch to runtime validation for changelog sections #4519 —AChangelogs.validate_sections(data, path=None)exists and is called fromAChangelog.data.Backward-compatibility principle (non-negotiable)
Detection is a single
is_dir()check against<project_path>/changelogs/current. No config flag, no version pin, no deprecation timeline. Both layouts must be supported indefinitely so that:release/v1.xx) cut before the migration keep working unchanged.If
changelogs/current/is a directory → entries layout. Otherwise → legacy layout. Implementation must be strict: the entries path must never run on a repo withoutcurrent/, and the legacy path must never look atcurrent/.What this PR does
File:
py/envoy.base.utils/envoy/base/utils/abstract/project/changelog.py1. Layout-detection helper on
AChangelogsAdd a property:
Match the existing file's style (other properties on
AChangelogsare@propertyor@cached_property). Do not cache — the directory may appear/disappear during a single process lifetime (e.g.write_versionremoves it). If profiling showsis_dir()is hot, a future PR can add a@cached_propertywith explicit invalidation; not this PR's problem.2. Per-entry directory path helper on
AChangelogsAdd a property that returns the entries directory path (parallel to
current_path/rel_current_path):Mirrors the existing
current_path/rel_current_pathpair exactly. These will be reused by PR 3b; introducing them now keeps the read-path PR self-contained.3. Dispatch
AChangelog.get_data/AChangelog.dataon layoutCurrent state (post-#4519):
AChangelog.get_datais a@classmethod— it has no access toAChangelogs, so it cannot do layout detection itself. The dispatch must happen inAChangelog.data(which hasself.project.changelogs).Change
datato detect layout and dispatch:Key constraints on this:
Gate on
self.is_current. The per-entry layout only applies to the current changelog. Historical<version>.yamlfiles keep using the legacy reader regardless of whethercurrent/exists.AChangeloghas access to its version viaself.version, andAChangelogsalready has anis_currentnotion (inAChangelogStatuson the checker side; on the aggregator side, current isnext(iter(self.changelogs))). The cleanest check is:self.version == changelogs.current. Use whichever spelling already exists in this file's style; if there isn't one, add a small private_is_currentproperty onAChangelog.validate_sectionsstill runs for both branches. It's source-agnostic and already exists onAChangelogs.The classmethod
get_datais unchanged. Do not touch its body.get_data_from_entriesis unchanged. Only the dispatch in the `...This pull request was created from Copilot chat.